// Learn TypeScript:
//  - https://docs.cocos.com/creator/manual/en/scripting/typescript.html
// Learn Attribute:
//  - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
//  - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html

import { UnitStateEnum } from "../UnitStateMachine";

const { ccclass, property } = cc._decorator;

@ccclass
export default class Animator extends cc.Component {
    @property(sp.Skeleton)
    hand: sp.Skeleton = null;
    @property(sp.Skeleton)
    wapon: sp.Skeleton = null;
    onLoad(){
        this.wapon.animation = '';
    }
    play(animName?: string) {
        if (animName == UnitStateEnum.Attack) {
            this.hand.setAnimation(0,'atk1',false);
            this.wapon.setAnimation(0,'atk2',false);
        }
    }
}
